package com.sdp.right.db.sys_dict_item.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sdp.right.db.sys_dict_item.mapper.SysDictItemMapper;
import com.sdp.right.db.sys_dict_item.service.ISysDictItemService;
import com.sdp.right.entity.SysDictItem;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zsp
 * @since 2023-10-11
 */
@Service
@DS(value="right")
public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDictItem> implements ISysDictItemService {

	@Override
	public List<SysDictItem> querySysDictItem(String dictCode) {
		LambdaQueryWrapper<SysDictItem> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(SysDictItem::getDictCode, dictCode);
		queryWrapper.orderByAsc(SysDictItem::getItemOrder);
		return list(queryWrapper);
	}

	@Override
	public void removeSysDictItem(String dictCode) {
		LambdaQueryWrapper<SysDictItem> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(SysDictItem::getDictCode, dictCode);
		remove(queryWrapper);
	}

}
